/* 
	1.该文件是用于创建一个为Count组件服务的reducer，reducer的本质就是一个函数
	2.reducer函数会接到两个参数，分别为：之前的状态(preState)，动作对象(action)
*/
import {CHANGE_LOADING} from '../contant'

export default function LoadingReducer(preState = { isLoading:false },action) {
	//从action对象中获取：type、data
	const { type,data } = action
	switch (type) {
		case CHANGE_LOADING:
			let newState = { ...preState }
			newState.isLoading = data;
			return newState
		default:
			return preState
		}
	}
  